mydata <- read.table("./Apartment.csv", 
                     header=TRUE, 
                     sep=";", 
                     dec=".")

print(mydata)
##    ID Price
## 1   1 3.794
## 2   2 4.162
## 3   3 4.205
## 4   4 3.972
## 5   5 3.630
## 6   6 4.382
## 7   7 3.656
## 8   8 3.499
## 9   9 3.780
## 10 10 4.067
## 11 11 3.983
## 12 12 3.659
## 13 13 4.759
## 14 14 2.838
## 15 15 3.540
## 16 16 3.472
## 17 17 3.837
## 18 18 2.983
## 19 19 4.662
## 20 20 4.213
## 21 21 4.277
## 22 22 4.221
## 23 23 3.765
## 24 24 3.335
## 25 25 3.545
## 26 26 3.095
## 27 27 2.908
## 28 28 3.908
## 29 29 3.553
## 30 30 3.395
## 31 31 3.455
head(mydata, 3)
##   ID Price
## 1  1 3.794
## 2  2 4.162
## 3  3 4.205
tail(mydata, 3)
##    ID Price
## 29 29 3.553
## 30 30 3.395
## 31 31 3.455

Description:

mean(mydata$Price)
## [1] 3.759677
sd(mydata$Price)
## [1] 0.476681
qt(p = 0.025, df = 30, lower.tail = FALSE)
## [1] 2.042272
qt(p = 0.025, df = 30, lower.tail = TRUE)
## [1] -2.042272
library(ggplot2)
ggplot(NULL, aes(c(-4, 4))) +
  theme_bw() +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "lightgray",  xlim = c(2.042272, 4)) +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "lightgray",  xlim = c(-4, -2.042272)) +
  geom_line(stat = "function", fun = dt, args = list (df = 30)) +
  ylab("Density") + 
  xlab("t-statistic") +
  labs(title="Distribution of the test statistic (df = 30)") +
  annotate("point", x = -2.6902, y = 0, colour = "darkred", size = 2.5) +
  annotate("text", x=-2.6, y=0.04, label="0.025") +
  annotate("text", x=2.6, y=0.04, label="0.025") +
  annotate("text", x=-2.80, y=-0.015, label="t = -2.6902") +
  geom_hline(yintercept=0)

library(ggplot2)
ggplot(mydata, aes(x = Price)) +
  geom_histogram(binwidth = 0.45, colour = "black") +
  ylab("Frequency") +
  xlab("Price per m2 in 1,000 EUR") 

shapiro.test(mydata$Price)
## 
##  Shapiro-Wilk normality test
## 
## data:  mydata$Price
## W = 0.98239, p-value = 0.8752
t.test(mydata$Price,
       mu = 3.990,
       alternative = "two.sided")
## 
##  One Sample t-test
## 
## data:  mydata$Price
## t = -2.6902, df = 30, p-value = 0.01155
## alternative hypothesis: true mean is not equal to 3.99
## 95 percent confidence interval:
##  3.584829 3.934525
## sample estimates:
## mean of x 
##  3.759677
library(ggplot2)
ggplot(NULL, aes(c(-4, 4))) +
  theme_bw() +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "lightgray",  xlim = c(2.042272, 4)) +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "lightgray",  xlim = c(-4, -2.042272)) +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "gray5",  xlim = c(2.6902, 4)) +
  geom_area(stat = "function", fun = dt, args = list (df = 30), fill = "gray5",  xlim = c(-4, -2.6902)) +
  geom_line(stat = "function", fun = dt, args = list (df = 30)) +
  ylab("Density") + 
  xlab("t-statistic") +
  labs(title="Distribution of the test statistic (df = 30)") +
  annotate("point", x = -2.6902, y = 0, colour = "darkred", size = 2.5) +
  annotate("point", x = 2.6902, y = 0, colour = "darkred", size = 2.5) +
  annotate("text", x=-2.6, y=0.04, label="0.025") +
  annotate("text", x=2.6, y=0.04, label="0.025") +
  annotate("text", x=-2.80, y=-0.015, label="t = -2.6902") +
  geom_hline(yintercept=0)

library(effectsize)
cohens_d(mydata$Price, mu = 3.990)
## Cohen's d |         95% CI
## --------------------------
## -0.48     | [-0.85, -0.11]
## 
## - Deviation from a difference of 3.99.
interpret_cohens_d(0.48, rules = "sawilowsky2009")
## [1] "small"
## (Rules: sawilowsky2009)